import Mock from "mockjs";
const Random = Mock.Random;
Mock.mock("/api/test", "get", () => {
  return {
    code: 200,
    data: {
      name: Random.name(),
      age: 18,
    },
  };
});

//问卷接口
Mock.mock("/api/qustion", "get", () => {
  return {
    code: 200,
    data: {
      id: Random.id(),
      title: Random.title(),
      componentList: [
        //Title
        {
          fe_id: Random.id(),
          type: "questionTitle",
          title: "标题",
          isHidden: false,
          isLock: false,
          props: { text: "个人信息调研", level: 1, isCenter: false },
        },
        //Input
        {
          fe_id: Random.id(),
          type: "questionInput",
          title: "Input",
          isHidden: false,
          isLock: false,
          props: {
            title: "你的名字",
            placeholder: "请输入你的姓名",
          },
        },
        //Input
        {
          fe_id: Random.id(),
          type: "questionInput",
          title: "Input",
          isHidden: false,
          isLock: false,
          props: {
            title: "你的电话",
            placeholder: "请输入你的电话",
          },
        },
        //Input
        {
          fe_id: Random.id(),
          type: "questionTextArea",
          title: "TextArea",
          isHidden: false,
          isLock: false,
          props: {
            title: "你的爱好",
            placeholder: "请输入....",
          },
        },
        //Paragraph
        {
          fe_id: Random.id(),
          type: "questionParagraph",
          title: "标题",
          isHidden: false,
          isLock: false,
          props: {
            text: "段落内容",
            isCenter: false,
          },
        },
        //Info组件
        {
          fe_id: Random.id(),
          type: "questionInfo",
          title: "问卷信息",
          isHidden: false,
          isLock: false,
          props: {
            title: "问卷标题",
            desc: "问卷描述.....",
          },
        },
        //单选组件
        {
          fe_id: Random.id(),
          type: "questionRadio",
          title: "单选",
          isHidden: false,
          isLock: false,
          props: {
            title: "单选",
            isVertical: false,
            options: [
              { value: "item1", text: "选项1" },
              { value: "item2", text: "选项2" },
              { value: "item3", text: "选项3" },
            ],
            value: "",
          },
        },
        //多选组件
        {
          fe_id: Random.id(),
          type: "questionCheckbox",
          title: "多选",
          isHidden: false,
          isLock: false,
          props: {
            title: "多选",
            isVertical: false,
            list: [
              { value: "item1", text: "选项1", checked: false },
              { value: "item2", text: "选项2", checked: false },
              { value: "item3", text: "选项3", checked: false },
              { value: "item4", text: "选项4", checked: false },
            ],
          },
        },
      ],
    },
  };
});
